<%-- 
    Document   : registrar_input
    Created on : 02/06/2011, 04:20:55 PM
    Author     : Andras
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>

<h1>Noticias</h1>
<br>
<%
try {
String connectionURL = "jdbc:postgresql://localhost:5432/cep";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
Class.forName("org.postgresql.Driver");
connection = DriverManager.getConnection(connectionURL, "cep", "123456");
statement = connection.createStatement();
String QueryString = "select * from noticia";
rs = statement.executeQuery(QueryString);
%>

<%
while (rs.next()) {
%>

<h2><%=rs.getString(2)%></h2>
<p><%=rs.getString(3)%></p>
<p><%=rs.getString(4)%></p>
<br>

<% } %>
<%
rs.close();
statement.close();
connection.close();
} catch (Exception ex) {
%>
</font>
<font size="+3" color="red"></b>
<%
out.println("Unable to connect to database.");
}
%>